package com.compression.tool.model.task;

/**
 * @author 自然醒
 * @version 1.0
 */

import com.compression.tool.util.FileUtils;

/**
 * 文件条目录信息类
 * 用于存储文件目录信息
 * 查看压缩文件中内容
 */
public class FileEntry {
    private String name;
    private String type;
    private long size;

    public FileEntry(String name, String type, long size) {
        this.name = name;
        this.type = type;
        this.size = size;
    }

    public String getName() { return name; }
    public String getType() { return type; }
    public long getSize() { return size; }

    @Override
    public String toString() {
        if ("directory".equals(type)) {
            return name + "/";
        } else {
            return name + " (" + FileUtils.formatFileSize(size) + ")";
        }
    }
}
